package com.pq.exception;

import com.pq.enums.Code;
import lombok.Getter;

/**
 * @author zhangfanghui
 * @since 2020 2020-12-01 15:16
 */
public class BizServiceException extends RuntimeException {

    @Getter
    private Code code;

    @Getter
    private final String errCode;

    @Getter
    private final String message;

    public BizServiceException(Code code) {
        this(code, null);
    }

    public BizServiceException(Code code, Throwable cause) {
        this(code.getCode(), code.getMessage(), cause);
        this.code = code;
    }

    public BizServiceException(String errCode, String message) {
        this(errCode, message, null);
    }

    public BizServiceException(String errCode, String message, Throwable cause) {
        super(message, cause);
        this.errCode = errCode;
        this.message = message;
    }
}
